#include "mainwindow.h"
#include "rpi_sensors.h"
#include <qfi_PFD.h>
#include <math.h>

const double num_pi = 2*acos(0);

imuWidget::imuWidget(QObject *parent,rpi_sensor_acc *a) {
    setupUi(this);

    flightInstrPFD = new qfi_PFD;
    flightWidget->addWidget(flightInstrPFD);

}

imuWidget::~imuWidget() {
    delete flightInstrPFD;
}


void imuWidget::refreshContent() {


}


void imuWidget::updateIMU(rpi_imu_9dof* i) {
    i->quat2euler();
    flightInstrPFD->setPitch(i->getEuler(1)*180.0/num_pi);
    flightInstrPFD->setHeading(i->getEuler(0)*180.0/num_pi);
    flightInstrPFD->setRoll(i->getEuler(2)*180.0/num_pi);
    flightInstrPFD->update();
    qDebug() << i->getEuler(1)*180.0/num_pi;
}
